const { Service } = require("egg");

class BlogService extends Service {
    /**
     * 添加博客
     * @param {string} title
     * @param {string} content
     * @param {number} uid
     */
    async addBlog(title, content, uid) {
        let sql = "insert into blog (title, content, uid) values (?, ?, ?)";
        let params = [title, content, uid];
        let res = await this.app.mysql.query(sql, params);
        return res;
    }
}

module.exports = BlogService;
